<template>
<div>
    <div>count: {{count}}</div>
    <!-- 1.使用$store.dispatch -->
    <div><button @click="$store.dispatch('incrementAsync', 2)">action++</button></div>
    <!-- 2. 使用mapActions -->
    <div><button @click="incrementAsync(2)">action++</button></div>
    <div><button @click="incrementAsyncAlias(2)">action++</button></div>
</div>
</template>

<script>
import {mapState, mapActions} from 'vuex'
export default {
    name: "Action",
    computed:{
        ...mapState(['count'])
    },
    methods:{
        ...mapActions(['incrementAsync']),
        ...mapActions({incrementAsyncAlias: 'incrementAsync'})
    },
}
</script>